<!DOCTYPE html>
<html>
<head>
    {include file="../application/common/header.html" /}
    <style>
        .datagrid-btable tr{height: 30px;}
    </style>
</head>

<body>
	<div id="student_zczrtb">
        <form id="student_zczrForm" class="m5">
            <?php echo currTerm()["termName"]?>
            <select class="form-control1" name="grade" id="grade" onchange="getClazz('student_zczr',this.value)"></select>
            <select class="form-control1" name="clazz" id="clazz"></select>
            在校状态：
            <select class="form-control1" name="schoolStatus" id="schoolStatus">
                <option value="">请选择</option>
                <option value="0">在校</option>
                <option value="1">已转出</option>
            </select>
            学生姓名：
            <input class="form-control1" type="text" name="studentName" id="studentName">
            <a class="easyui-linkbutton l-btn l-btn-small" data-options="iconCls:'icon-search'" onclick="searchForm('student_zczr')">查询</a>
            <a class="easyui-linkbutton l-btn l-btn-small" data-options="iconCls:'icon-clear'" onclick="resetForm('student_zczr')">重置</a><br/>
        </form>
    </div>
    <table id="student_zczrdg">
    	<thead>
			<tr>
                <th data-options="field:'年级号',title:'年级号',width:50,formatter:function(value,row,index){
                    return row.gradeName;
                }"></th>
                <th data-options="field:'班号',title:'班号',width:50"></th>
                <th data-options="field:'学号',title:'学号',width:50"></th>
                <th data-options="field:'姓名',title:'姓名',width:50"></th>
                <th data-options="field:'转出学期ID',title:'在校状态',width:50,sortable:true,formatter:function(value,row,index){
                    if(value > 0) return '<span style=\'color:red;\'>已转出</span>';
                    return '在校';
                }"></th>
                <th data-options="width:50,align:'center',field:'操作',formatter:function(value,row,index){
                    if(row.转出学期ID > 0) return '<button type=\'button\' class=\'btn btn-warning btn-xs\' onClick=studentZczr('+row.ID+',0)>转入</button>';
                    return '<button type=\'button\' class=\'btn btn-danger btn-xs\' onClick=studentZczr('+row.ID+',1)>转出</button>';
                }">操作</th>
			</tr>
		</thead>
        
    </table>

    <script type="text/javascript">
        $(function(){
            var url = "/student/student_zczr";
            initDatagrid("student_zczr",url);
            initGrade("student_zczr");
        })
        function initDatagrid(cf,url) {
			$("#"+cf+"dg").datagrid({
				url: url + "/pageQuery.html",
				rownumbers: true,
				striped: true,
				border: false,
				pagination: true,
				pageSize: 30,
				fitColumns: true,
				autoRowHeight: false,
				singleSelect: true,
				fit: true,
				toolbar: []
			})
			var tb = $("#"+cf+"tb").html();
			if(tb) {
				$(".datagrid-toolbar").prepend(tb);
				$("#"+cf+"tb").remove();
			}
		}
		function studentZczr(ID, type) {
            $.ajax({
                url: "{:url('StudentZczr/zczr')}",
                type: 'POST',
                data: {
                    ID: ID,
                    type: type
                }
            }).done(function(data) {
                if(data == '000') {
                    $.messager.show({title:'操作提示', msg:"提交成功"});
                    reload("student_zczr");
                }
                
            }).fail(function() {
                $('#msg').html('error,发生错误请及时联系管理员!');
            });
        }
    </script>
</body>
</html>